define(['vue', 'common'], function (Vue, app) {
  app.loadCss(require.toUrl('../html/components/toast/index.css'))
  let ToastConstruction = Vue.extend({
    template: `
      <div>
        <div class="app-toast">{{text}}</div>
      </div>
    `,
    data () {
      return {
        text: 'qadasd驱蚊器二无群二！！'
      }
    }
  })
  function showToast (text = '111', duration) {
    let toast = new ToastConstruction()
    let el = toast.$mount().$el
    document.body.appendChild(el)
    setTimeout(() => {
      document.body.removeChild(el)
    }, 2000)
  }
  function registryToast () {
    Vue.prototype.$toast = showToast
  }

  return registryToast
})
